﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/Main.Master" AutoEventWireup="true" CodeBehind="EmployeeManagementAdd.aspx.cs" Inherits="RestaurantManagerWebApp.Pages.UserManagement.MainUserManagement" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
    .auto-style12 {
        width: 110px;
    }
    .auto-style13 {
        width: 8px;
    }
        .auto-style15 {
        width: 354px;
    }
    </style>
    <style type="text/css">
    .GridPosition
    {
    	position:absolute;
    	left:100px;
    	top:400px;
    	height:200px;
    	width:200px;
    

    }
        .auto-style16 {
            width: 222px;
        }
        .auto-style21 {
            width: 84px;
        }
        .auto-style22 {
            width: 104px;
        }
    .auto-style23 {
        width: 191px;
    }
        .auto-style24 {
            height: 58px;
        }
        .auto-style25 {
            width: 354px;
            height: 58px;
        }
        .auto-style26 {
            width: 191px;
            height: 58px;
        }
    </style>
    <script type="text/javascript">
        window.scrollTo = function (x, y) {
            return true;
        }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <p style="text-align: center">
    <asp:Label ID="Label3" runat="server" Text="Insert Employee Record Portal" ForeColor="Blue" style="text-align: center" Font-Bold="True" Font-Size="Larger"></asp:Label>
         
   
</p>
    <p>
    <asp:LinkButton ID="lbHome" runat="server" CausesValidation="False" PostBackUrl="~/Pages/UserManagement/ManagementHome.aspx">Home</asp:LinkButton>
    </p>
    <div style="width: 100%; height: 180px; overflow: auto">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="emp_id" DataSourceID="EMP_Records" HeaderStyle-BackColor = "yellow" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnRowUpdating="GridView1_RowUpdating" OnRowEditing="GridView1_RowEditing" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowDeleting="GridView1_RowDeleting" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" AllowPaging="True" GridLines="Vertical" Width="1340px">
        <AlternatingRowStyle BackColor="#DCDCDC" />
        <Columns>
            <asp:BoundField DataField="id_no" HeaderText="User ID" SortExpression="id_no" >
            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:BoundField>
            <asp:BoundField DataField="emp_id" HeaderText="Employee ID" ReadOnly="True" SortExpression="emp_id" >
            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:BoundField>
            <asp:BoundField DataField="fname" HeaderText="First Name" SortExpression="fname" >
            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:BoundField>
            <asp:BoundField DataField="lname" HeaderText="Last Name" SortExpression="lname" >
            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:BoundField>
            <asp:BoundField DataField="dob" HeaderText="DOB" SortExpression="dob"   >
            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:BoundField>
            <asp:BoundField DataField="hp_no" HeaderText="Handphone No" SortExpression="hp_no" >
            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:BoundField>
            <asp:BoundField DataField="address" HeaderText="Address" SortExpression="address" >
            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:BoundField>
            <asp:BoundField DataField="email" HeaderText="Email" SortExpression="email" >
            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:BoundField>
            <asp:BoundField DataField="bank_acc" HeaderText="Bank Account No" SortExpression="bank_acc" >
            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:BoundField>
            <asp:BoundField DataField="nationality" HeaderText="Nationality" SortExpression="nationality" >
            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:BoundField>
            <asp:BoundField DataField="when_joined" HeaderText="Joined Date" SortExpression="when_joined" >
            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:BoundField>
        </Columns>

        <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />

<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White"></HeaderStyle>
        
        <PagerStyle ForeColor="Black" HorizontalAlign="Center" BackColor="#999999" />
        <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
        <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F1F1F1" />
        <SortedAscendingHeaderStyle BackColor="#0000A9" />
        <SortedDescendingCellStyle BackColor="#CAC9C9" />
        <SortedDescendingHeaderStyle BackColor="#000065" />
        
    </asp:GridView>
        </div>
                <table style="width: 99%; margin-bottom: 0px; height: 235px; margin-top: 77px; border-color:black; border-style:solid">
        <tr>
            <td class="auto-style13">
                <asp:Label ID="lblUserID" runat="server" Text="User ID:"></asp:Label>
            </td>
            <td class ="auto-style15">
                <asp:TextBox ID="txtUserID" runat="server" Width="203px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*Required Field" ForeColor="Red" ControlToValidate="txtUserID"></asp:RequiredFieldValidator>
                </td>

            <td class="auto-style12">
                <asp:Label ID="lblHpno" runat="server" Text="Handphone No:"></asp:Label>
            </td>
            <td class ="auto-style23">
                <asp:TextBox ID="txtHP" runat="server" Width="203px"></asp:TextBox>
                </td>
            <td class="auto-style22"></td>
            <td class="auto-style21"><asp:Label ID="Label4" runat="server" Text="Photo Name:"></asp:Label></td>
            <td><asp:TextBox ID="txtpname" runat="server"></asp:TextBox></td>
            <td class="auto-style16" rowspan="5">
                
                
                <br />
                <br />
                <br />
                
                <br />
                
            </td>

        </tr>
        <tr>
            <td class="auto-style13">
                <asp:Label ID="lblPassword" runat="server" Text="Password:"></asp:Label>
            </td>
            <td class ="auto-style15">
                <asp:TextBox ID="txtPassword" runat="server" Width="203px" TextMode="Password"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="*Required Field" ForeColor="Red" ControlToValidate="txtPassword"></asp:RequiredFieldValidator>
                </td>
            <td class="auto-style12">
                <asp:Label ID="lblAddr" runat="server" Text="Address:"></asp:Label>
            </td>
            <td class ="auto-style23">
                <asp:TextBox ID="txtAddr" runat="server" Width="203px"></asp:TextBox>
                </td>      
            <td class="auto-style22"></td>
            <td colspan="2" rowspan="4">
                <asp:Image ID="Image1" runat="server" Height="221px" Width="241px" style="margin-left: 0px" />
                <br />
                <br />
                <asp:FileUpload ID="FileUpload1" runat="server" />
                
                <br />
                <asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Upload" CausesValidation="False" Width="81px" />
                
            &nbsp;&nbsp;
    <asp:Button ID="lblCancelPic" runat="server" Text="Cancel" OnClick="lblCancelPic_Click" CausesValidation="False" />
                
            </td> 
        </tr>
        <tr>
            <td class="auto-style13">
                <asp:Label ID="lblEmployeeID" runat="server" Text="Employee ID:"></asp:Label>
            </td>
            <td class ="auto-style15">
                <asp:TextBox ID="txtEmpID" runat="server" Width="203px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*Required Field" ForeColor="Red" ControlToValidate="txtEmpID"></asp:RequiredFieldValidator>
                </td>
            <td class="auto-style12">
                <asp:Label ID="lblEmail" runat="server" Text="Email:"></asp:Label>
            </td>
            <td class ="auto-style23">
                <asp:TextBox ID="txtEmail" runat="server" Width="203px"></asp:TextBox>
                </td>
        </tr>
            <tr>
            <td class="auto-style13">
                <asp:Label ID="lblFname" runat="server" Text="First Name:"></asp:Label>
                </td>
                <td class ="auto-style15">
                <asp:TextBox ID="txtFname" runat="server" Width="203px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*Required Field" ForeColor="Red" ControlToValidate="txtFname"></asp:RequiredFieldValidator>
                </td>
            <td class="auto-style12">
                <asp:Label ID="lblBankAcc" runat="server" Text="Bank Account No:"></asp:Label>
                </td>
                <td class ="auto-style23">
                <asp:TextBox ID="txtBankAcc" runat="server" Width="203px"></asp:TextBox>
                </td>
        </tr>
            <tr>
            <td class="auto-style13">
                <asp:Label ID="lblLname" runat="server" Text="Last Name:"></asp:Label>
                </td>
                <td class ="auto-style15">
                    <asp:TextBox ID="txtLname" runat="server" Width="203px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="*Required Field" ForeColor="Red" ControlToValidate="txtLname"></asp:RequiredFieldValidator>
                </td>
            <td class="auto-style12">
                <asp:Label ID="lblNationality" runat="server" Text="Nationality:"></asp:Label>
                </td>
                <td class ="auto-style23">
                    <asp:DropDownList ID="ddlNationality" runat="server" Width="208px" AppendDataBoundItems="true" AutoPostBack="False">
                        <asp:ListItem Text="Please Select" Value="" /> 
                        <asp:ListItem>Singaporean</asp:ListItem>
                        <asp:ListItem>Malaysian</asp:ListItem>
                        <asp:ListItem>Taiwanese</asp:ListItem>
                        <asp:ListItem>Chinese</asp:ListItem>
                        <asp:ListItem>Vietnamese</asp:ListItem>
                        <asp:ListItem>Thai</asp:ListItem>
                        <asp:ListItem>African</asp:ListItem>
                        <asp:ListItem>American</asp:ListItem>
                        <asp:ListItem>Swiss</asp:ListItem>
                        <asp:ListItem>French</asp:ListItem>
                        <asp:ListItem>Italian</asp:ListItem>
                    </asp:DropDownList>
                </td>
            
        </tr>
        <tr> 
            <td class="auto-style24">
                <asp:Label ID="lblRole" runat="server" Text="Role:"></asp:Label>
                </td>
            <td class="auto-style25">
                    <asp:DropDownList ID="ddlRoles" runat="server" Width="208px" DataSourceID="SqlDataSource1_Roles" DataTextField="role" DataValueField="role" AppendDataBoundItems="true" AutoPostBack="false">
                        <asp:ListItem Text="Please Select" Value=""/> 
                    </asp:DropDownList>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="*Required Field" ForeColor="Red" ControlToValidate="ddlRoles"></asp:RequiredFieldValidator>
                </td>
            <td class="auto-style24">
                </td>
            <td class="auto-style26">
                </td> 

        </tr>
        <tr> 
            <td>
                <asp:Label ID="lblDob" runat="server" Text="DOB:"></asp:Label>

                </td> 
            <td class="auto-style15">
                    <asp:TextBox ID="txtDOB" runat="server" Width="184px"></asp:TextBox>
                    <asp:Button ID="btnShowDOB" runat="server" Text="..." OnClick="btnShowDOB_Click" CausesValidation="False"/>
                    <asp:Calendar ID="calendar" runat="server" Width="220px" BackColor="White" BorderColor="#3366CC" BorderWidth="1px" CellPadding="1" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="#003399" Height="200px" OnSelectionChanged="calendar_SelectionChanged" Visible="False">
                        <DayHeaderStyle BackColor="#99CCCC" ForeColor="#336666" Height="1px" />
                        <NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
                        <OtherMonthDayStyle ForeColor="#999999" />
                        <SelectedDayStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                        <SelectorStyle BackColor="#99CCCC" ForeColor="#336666" />
                        <TitleStyle BackColor="#003399" BorderColor="#3366CC" BorderWidth="1px" Font-Bold="True" Font-Size="10pt" ForeColor="#CCCCFF" Height="25px" />
                        <TodayDayStyle BackColor="#99CCCC" ForeColor="White" />
                        <WeekendDayStyle BackColor="#CCCCFF" />
                    </asp:Calendar>
                </td>
            <td>
                <asp:Label ID="lblJoinDate" runat="server" Text="Joined Date:" style="text-align: left"></asp:Label>
           
 
           
            </td>
            
            <td class="auto-style23">
                    <asp:TextBox ID="txtJDate" runat="server" Width="167px"></asp:TextBox>
                    <asp:Button ID="btnShowJDate" runat="server" Text="..." OnClick="btnShowJDate_Click" CausesValidation="False" />
                <asp:Calendar ID="calJoinDate" runat="server" Width="220px" BackColor="White" BorderColor="#3366CC" BorderWidth="1px" CellPadding="1" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="#003399" Height="200px" OnSelectionChanged="calJoinDate_SelectionChanged" Visible="False">
                    <DayHeaderStyle BackColor="#99CCCC" ForeColor="#336666" Height="1px" />
                    <NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
                    <OtherMonthDayStyle ForeColor="#999999" />
                    <SelectedDayStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                    <SelectorStyle BackColor="#99CCCC" ForeColor="#336666" />
                    <TitleStyle BackColor="#003399" BorderColor="#3366CC" BorderWidth="1px" Font-Bold="True" Font-Size="10pt" ForeColor="#CCCCFF" Height="25px" />
                    <TodayDayStyle BackColor="#99CCCC" ForeColor="White" />
                    <WeekendDayStyle BackColor="#CCCCFF" />
                </asp:Calendar>
            </td>
        </tr>
        </table>
<p>
    <asp:Button ID="lblAdd" runat="server" Text="Add Record" OnClick="lblAdd_Click" />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Button ID="lblCancel" runat="server" Text="Cancel" OnClick="lblCancel_Click" CausesValidation="False" />
    <asp:SqlDataSource ID="EMP_Records" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [Emp_records] WHERE [emp_id] = @original_emp_id AND [id_no] = @original_id_no AND (([fname] = @original_fname) OR ([fname] IS NULL AND @original_fname IS NULL)) AND (([lname] = @original_lname) OR ([lname] IS NULL AND @original_lname IS NULL)) AND (([dob] = @original_dob) OR ([dob] IS NULL AND @original_dob IS NULL)) AND (([hp_no] = @original_hp_no) OR ([hp_no] IS NULL AND @original_hp_no IS NULL)) AND (([address] = @original_address) OR ([address] IS NULL AND @original_address IS NULL)) AND (([email] = @original_email) OR ([email] IS NULL AND @original_email IS NULL)) AND (([bank_acc] = @original_bank_acc) OR ([bank_acc] IS NULL AND @original_bank_acc IS NULL)) AND (([nationality] = @original_nationality) OR ([nationality] IS NULL AND @original_nationality IS NULL)) AND (([when_joined] = @original_when_joined) OR ([when_joined] IS NULL AND @original_when_joined IS NULL)) AND (([p_id] = @original_p_id) OR ([p_id] IS NULL AND @original_p_id IS NULL))" InsertCommand="INSERT INTO [Emp_records] ([id_no], [emp_id], [fname], [lname], [dob], [hp_no], [address], [email], [bank_acc], [nationality], [when_joined], [p_id]) VALUES (@id_no, @emp_id, @fname, @lname, @dob, @hp_no, @address, @email, @bank_acc, @nationality, @when_joined, @p_id)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT Emp_records.id_no, Emp_records.emp_id, Emp_records.fname, Emp_records.lname, Emp_records.dob, Emp_records.hp_no, Emp_records.address, Emp_records.email, Emp_records.bank_acc, Emp_records.nationality, Emp_records.when_joined, u.role FROM Emp_records INNER JOIN Users AS u ON Emp_records.emp_id = u.emp_id" UpdateCommand="UPDATE [Emp_records] SET [id_no] = @id_no, [fname] = @fname, [lname] = @lname, [dob] = @dob, [hp_no] = @hp_no, [address] = @address, [email] = @email, [bank_acc] = @bank_acc, [nationality] = @nationality, [when_joined] = @when_joined, [p_id] = @p_id WHERE [emp_id] = @original_emp_id AND [id_no] = @original_id_no AND (([fname] = @original_fname) OR ([fname] IS NULL AND @original_fname IS NULL)) AND (([lname] = @original_lname) OR ([lname] IS NULL AND @original_lname IS NULL)) AND (([dob] = @original_dob) OR ([dob] IS NULL AND @original_dob IS NULL)) AND (([hp_no] = @original_hp_no) OR ([hp_no] IS NULL AND @original_hp_no IS NULL)) AND (([address] = @original_address) OR ([address] IS NULL AND @original_address IS NULL)) AND (([email] = @original_email) OR ([email] IS NULL AND @original_email IS NULL)) AND (([bank_acc] = @original_bank_acc) OR ([bank_acc] IS NULL AND @original_bank_acc IS NULL)) AND (([nationality] = @original_nationality) OR ([nationality] IS NULL AND @original_nationality IS NULL)) AND (([when_joined] = @original_when_joined) OR ([when_joined] IS NULL AND @original_when_joined IS NULL)) AND (([p_id] = @original_p_id) OR ([p_id] IS NULL AND @original_p_id IS NULL))">
        <DeleteParameters>
            <asp:Parameter Name="original_emp_id" Type="String" />
            <asp:Parameter Name="original_id_no" Type="Int32" />
            <asp:Parameter Name="original_fname" Type="String" />
            <asp:Parameter Name="original_lname" Type="String" />
            <asp:Parameter DbType="Date" Name="original_dob" />
            <asp:Parameter Name="original_hp_no" Type="Decimal" />
            <asp:Parameter Name="original_address" Type="String" />
            <asp:Parameter Name="original_email" Type="String" />
            <asp:Parameter Name="original_bank_acc" Type="String" />
            <asp:Parameter Name="original_nationality" Type="String" />
            <asp:Parameter DbType="Date" Name="original_when_joined" />
            <asp:Parameter Name="original_p_id" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="id_no" Type="Int32" />
            <asp:Parameter Name="emp_id" Type="String" />
            <asp:Parameter Name="fname" Type="String" />
            <asp:Parameter Name="lname" Type="String" />
            <asp:Parameter DbType="Date" Name="dob" />
            <asp:Parameter Name="hp_no" Type="Decimal" />
            <asp:Parameter Name="address" Type="String" />
            <asp:Parameter Name="email" Type="String" />
            <asp:Parameter Name="bank_acc" Type="String" />
            <asp:Parameter Name="nationality" Type="String" />
            <asp:Parameter DbType="Date" Name="when_joined" />
            <asp:Parameter Name="p_id" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="id_no" Type="Int32" />
            <asp:Parameter Name="fname" Type="String" />
            <asp:Parameter Name="lname" Type="String" />
            <asp:Parameter DbType="Date" Name="dob" />
            <asp:Parameter Name="hp_no" Type="Decimal" />
            <asp:Parameter Name="address" Type="String" />
            <asp:Parameter Name="email" Type="String" />
            <asp:Parameter Name="bank_acc" Type="String" />
            <asp:Parameter Name="nationality" Type="String" />
            <asp:Parameter DbType="Date" Name="when_joined" />
            <asp:Parameter Name="p_id" Type="Int32" />
            <asp:Parameter Name="original_emp_id" Type="String" />
            <asp:Parameter Name="original_id_no" Type="Int32" />
            <asp:Parameter Name="original_fname" Type="String" />
            <asp:Parameter Name="original_lname" Type="String" />
            <asp:Parameter DbType="Date" Name="original_dob" />
            <asp:Parameter Name="original_hp_no" Type="Decimal" />
            <asp:Parameter Name="original_address" Type="String" />
            <asp:Parameter Name="original_email" Type="String" />
            <asp:Parameter Name="original_bank_acc" Type="String" />
            <asp:Parameter Name="original_nationality" Type="String" />
            <asp:Parameter DbType="Date" Name="original_when_joined" />
            <asp:Parameter Name="original_p_id" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
                    <asp:SqlDataSource ID="SqlDataSource1_Roles" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [role] FROM [Roles]"></asp:SqlDataSource>
    </p>

</asp:Content>
